package top.heliming.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

/**
 * description: //定义拦截器
 *
 * @author: heliming
 * @date:2019/05/22 上午 1:35
 */
public class LoginInterceptor implements HandlerInterceptor {
  private Logger logger = LoggerFactory.getLogger(LoginInterceptor.class);
  @Override
  public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
    logger.debug("preHandle method is now running!");
    return true;
  }

  @Override
  public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) {
    logger.debug("postHandle method is now running!");

  }

  @Override
  public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
    logger.debug("afterCompletion method is now running!");
  }
}
